<script setup>
// #ifdef APP-PLUS
import APPUpdate from '@/uni_modules/uiwu-sdk/js_sdk/update';
// #endif
import { onLaunch, onShow, onHide } from "@dcloudio/uni-app";
import {
  sysConfig,
  getConfig
} from '@/api/interface/interface';
import qjscss from "./static/css/qujia.module.scss";
import { useCssStore } from "@/store/cssStore";
import { getAppConfig, setJssdk } from '@/api/common';
import { configStore } from '@/store/configStore';
import { getCurrentInstance } from 'vue';
import { userStore } from './store/userStore';
onLaunch((query) => {

  /** 设置Scss变量 */
  useCssStore().setCss(qjscss);

  // 截取页面分享出来的参数
  if (query?.spread_uid) {
    uni.setStorageSync('spread_uid', query.spread_uid)
  }
  // 截取扫码二维码出来的参数
  if (query.scene) {
    const scene = decodeURIComponent(query.scene);
    const spread_uid = scene.split('spread_uid=')[1] || '';
    uni.setStorageSync('spread_uid', spread_uid)
  }
  // #ifdef APP-PLUS
  APPUpdate(true)
  // #endif


  uni.hideTabBar()
  sysConfig('douyin_use_is_show').then(res => {
    const { setDouyinIsShow, setRecharge, setSysConfig } = configStore();
    setSysConfig(res.data);
    setDouyinIsShow(res.data.douyin_use_is_show);
    setRecharge(res.data.recharge_switch);
  })
  getAppConfig();

});
onShow(() => {
  // #ifdef WEB
  const { sysConfig } = configStore();
  setJssdk(sysConfig, getCurrentInstance());
  // #endif
  console.log("App Show");
  const { updateUserInfo } = userStore();
  updateUserInfo();
});
onHide(() => {
  console.log("App Hide");
});
</script>
<style lang="scss">
@import "@/static/css/qujia.common.scss";

@import "tailwindcss/base";
//pc端自适应相关样式小程序端可以不需要
@import "tailwindcss/components";
@import "tailwindcss/utilities";

body {
  overflow-x: hidden !important;
}
</style>
